#ifndef __DISPLAY_H__
#define __DISPLAY_H__

#include <Time.h>
#include "Illumination.h"
#include "Thermometer.h"
#include "Storage.h"
#include "Cooling.h"

class Display : public Actuator, public CommandProcessor {
private:
    uint8_t backlight;

    time_t previousTime;
    time_t lastLevelsTime;

    uint8_t previousMode;
    uint8_t previousCooling;
    temperature_t previousTemperature;

private:
    void printLevel(uint8_t c, uint8_t r, uint8_t level);


    void validateCooling(Cooling const &cooling);

    void validateThermometer(const Thermometer &thermometer);

    void validateIllumination(const Illumination &illumination);

public:
    Display();


    uint8_t getBacklight();

    void setBacklight(uint8_t value);


    void showError(const error_t error);

    void validate(const Timer &timer, const Illumination &illumination, const Thermometer &thermometer, const Cooling &cooling);

public:
    virtual const error_t begin();

    virtual const error_t tick(const tick_t ticks, const time_t time);

public:
    virtual const bool isSupported(String const &request);

    virtual const error_t processCommand(String const &request, String &response);
};

#endif
